1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4
5 public
class CameraMove : MonoBehaviour {
6
7     
public static float offSetX;
8
9     
void Start () {
10         
11     }
12     
13     
void Update () {
14         
if (PlayerScript.instance != null) {
15             
if (PlayerScript.instance.isAlive) {
16                 MoveCamera();
17             }
18         }
19     }
20
21     
void MoveCamera() {
22         Vector3 temp = transform.position;
23         temp.x = PlayerScript.instance.GetPositionX() + offSetX;
24         transform.position = temp;
25     }
26 }



Trò chơi Halloween vui nhộn trong UNITY Engine 10.808 lượt xem

Gõ tìm kiếm nhanh...